#ifndef RENDERER_H_
#define RENDERER_H_

#include "render_object.h"
#include "window.h"
#include "colors.h"
#include "shaders.h"
#include "../mathematics.h"
#include "../objects.h"

#include <vector>

class CRenderer
{
	private:
		CWindow *pWindow;

        ShaderProgram *pUsingShader;
        CMaterial *pUsingMaterial;

		Color3 ClearColor;

		Matrix4x4 *matProjection;
		Matrix4x4 *matView;

		vector<RenderObject*> Objects;
		vector<GLuint> ObjectPrimitives;
	public:
		void Init();

		void LinkWindow(CWindow *pointerWindow);
		void InitWindow();

		void SetDisplayMode(int nWidth, int nHeight, int nBpp, Uint32 uFlags);
		void ChangeDisplaySize(int nWidth, int nHeight);

		void SetClearColor(Color3 col);

		int AddObject(RenderObject *pNewObject, GLuint uPrimitive = GL_TRIANGLES); //returns index of object

        RenderObject* GetObjectPointer(int nIndex);

        Matrix4x4* GetMatViewPointer(){return matView;}
        Matrix4x4* GetMatProjPointer(){return matProjection;}

		void Render();
};

#endif
